cmake_minimum_required(VERSION 3.8)
project(string_regex_match)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" var1 "3.8.16")
message(STATUS "var1 = ${var1}")
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" var2 "3.8.16.4")
message(STATUS "var2 = ${var2}")
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" var3 "3.8.16" "3.9.2")
message(STATUS "var3 = ${var3}")
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" var4 "3.8." "16")
message(STATUS "var4 = ${var4}")
